// pages/zhufu/zhufu.js
var util = require('../../utils/util.js');

Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:'',
    userName:'',
    content:'',
    userHeader:'',

    relation:1,
    festival:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      name: options.name,
      userName: options.userName,
      content: options.content,
      relation: options.relation,
      festival: options.festival,
      userHeader: options.avatarUrl
    })
    if (options.Rezhufu){
      this.setData({
        content: options.Rezhufu,
      })
    }

  },

  // 推荐
  select:function(){
    wx.navigateTo({
      url: 'choose?festival=' + this.data.festival + '&relation=' + this.data.relation + '&name=' + this.data.name + '&userName=' + this.data.userName + '&avatarUrl=' + this.data.userHeader,
    })
  },

  //
  chenhu:function(e){
    // console.log(e.detail.value)
    this.setData({
      name: e.detail.value
    })
  },
  //
  user: function (e) {
    // console.log(e.detail.value)
    this.setData({
      userName: e.detail.value
    })
  },

  //
  formSubmit:function(e){
    var data = e.detail.value
    var chenhu = data.chenhu
    var zhufu = data.zhufu
    var content = data.textarea
    wx.redirectTo({
      url: 'result?name=' + chenhu + '&userName=' + zhufu + '&Recontent=' + content + '&avatarUrl=' + this.data.userHeader + '&relation=' + this.data.relation + '&festival=' + this.data.festival,
    })
  }

})